-
Notifications
You must be signed in to change notification settings - Fork 15
feat: implement Hyperblock Fusion optimization #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add HyperblockDependencyAnalysis for detecting RAW/WAR/WAW dependencies - Implement OptimizeTaskGraphPass with hyperblock fusion and dead hyperblock elimination - Handle SSA outputs by creating new hyperblock with combined result types - Support non-adjacent hyperblock fusion by checking all (i,j) pairs - Allow RAW dependencies since operation ordering is preserved - Add hyperblock-fusion.mlir, nested-fusion.mlir, and fusion-with-outputs.mlir tests - Fix relu_kernel.mlir deterministic checks for upstream compatibility - Update CMakeLists.txt and TaskflowPasses registration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a Hyperblock Fusion optimization pass for the Taskflow dialect to reduce task scheduling overhead and improve CGRA resource utilization. The implementation includes dependency analysis, hyperblock fusion within tasks, and dead hyperblock elimination.
Changes:
- Adds hyperblock dependency analysis (RAW/WAR/WAW detection) to enable safe fusion decisions
- Implements hyperblock fusion optimization that merges compatible hyperblocks with identical counter structures
- Adds three test files demonstrating fusion in different scenarios (basic, nested, with different operations)
- Updates test expectations in
relu_kernel.mlirto reflect changes from the optimization pass
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
include/TaskflowDialect/Analysis/HyperblockDependencyAnalysis.h |
Defines dependency analysis API for detecting memory dependencies between hyperblocks |
lib/TaskflowDialect/Analysis/HyperblockDependencyAnalysis.cpp |
Implements RAW/WAR/WAW dependency detection and fusion safety checks |
lib/TaskflowDialect/Transforms/OptimizeTaskGraphPass.cpp |
Core optimization pass implementing hyperblock fusion and dead code elimination |
lib/TaskflowDialect/Analysis/CMakeLists.txt |
Adds analysis library to build system |
lib/TaskflowDialect/Transforms/CMakeLists.txt |
Links optimization pass with analysis library |
lib/TaskflowDialect/CMakeLists.txt |
Adds Analysis subdirectory to build |
include/TaskflowDialect/TaskflowPasses.td |
Defines pass options and documentation |
include/TaskflowDialect/TaskflowPasses.h |
Adds pass creation function declaration |
test/multi-cgra/taskflow/optimization/hyperblock-fusion.mlir |
Tests basic hyperblock fusion scenario (currently tests non-fusion case) |
test/multi-cgra/taskflow/optimization/nested-fusion.mlir |
Tests fusion of nested loops within same task |
test/multi-cgra/taskflow/optimization/fusion-with-outputs.mlir |
Tests fusion with different operation types |
test/e2e/relu/relu_kernel.mlir |
Updates test expectations after optimization pass changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Complete fuseHyperblocksInTask function comment - Add null check for getDialect() in estimateHyperblockResources - Fix posA/posB swap in HyperblockDependencyAnalysis::canFuse - Fix enableTaskFusion default to false in TaskflowPasses.td - Update hyperblock-fusion.mlir test description for accuracy - Revert relu_kernel.mlir to main branch version
86d7467 to
ea09163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tancheng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz use snake_case variable naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove?
|
Hi~ @guosran, I think a better start for I will determine our affine controller design today and I will sync with you so that you can start. |
Summary
Implements the
OptimizeTaskGraphpass for the Taskflow dialect, enabling Hyperblock Fusion optimization to reduce task scheduling overhead and improve CGRA resource utilization.Changes
New Files
Core Features
Dependency Analysis (HyperblockDependencyGraph)
Hyperblock Fusion (fuseHyperblocks)
Dead Hyperblock Elimination
Future Work